package br.com.edumobi.fragments;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import br.com.edumobi.R;

public class LauncherQuestoesFragment extends GenericoFragment {

    private TextView textViewNomeTelaLauncherQuestoes;
    private TextView textViewOrientacaoLauncherQuestoes;
    private Button buttonEstudoLauncherQuestoes;
    private Button buttonSimuladoLauncherQuestoes;

    private AcoesLauncherQuestoesFragment activity;

    private View.OnClickListener clickButtonEstudoLauncherQuestoes = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            activity.openQuestoesEstudo();
        }
    };

    private View.OnClickListener clickButtonSimuladoLauncherQuestoes = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            activity.openQuestoesSimulado();
        }
    };

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        activity = (AcoesLauncherQuestoesFragment) getActivity();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_launcher_questoes, container, false);

        textViewNomeTelaLauncherQuestoes = (TextView) view.findViewById(R.id.textViewNomeTelaLauncherQuestoes);
        textViewOrientacaoLauncherQuestoes = (TextView) view.findViewById(R.id.textViewOrientacaoLauncherQuestoes);
        buttonEstudoLauncherQuestoes = (Button) view.findViewById(R.id.buttonEstudoLauncherQuestoes);
        buttonSimuladoLauncherQuestoes = (Button) view.findViewById(R.id.buttonSimuladoLauncherQuestoes);

        buttonEstudoLauncherQuestoes.setOnClickListener(clickButtonEstudoLauncherQuestoes);
        buttonSimuladoLauncherQuestoes.setOnClickListener(clickButtonSimuladoLauncherQuestoes);

        return view;
    }

    @Override
    public void showComponents() {
        textViewNomeTelaLauncherQuestoes.setVisibility(View.VISIBLE);
        textViewOrientacaoLauncherQuestoes.setVisibility(View.VISIBLE);
        buttonEstudoLauncherQuestoes.setVisibility(View.VISIBLE);
        buttonSimuladoLauncherQuestoes.setVisibility(View.VISIBLE);
    }

    @Override
    public void hideComponents() {
        textViewNomeTelaLauncherQuestoes.setVisibility(View.GONE);
        textViewOrientacaoLauncherQuestoes.setVisibility(View.GONE);
        buttonEstudoLauncherQuestoes.setVisibility(View.GONE);
        buttonSimuladoLauncherQuestoes.setVisibility(View.GONE);
    }

    public interface AcoesLauncherQuestoesFragment extends AcoesGenericoFragment {
        public void openQuestoesEstudo();
        public void openQuestoesSimulado();
    }
}
